﻿Imports WeifenLuo.WinFormsUI.Docking
Public Class ImageViewForm
  Inherits DockContent
  Implements IChangeListener

  Private _filepath As String
  Private _wallpaper As Wallpaper

  Public Shadows Sub Show(ByVal dockpanel As DockPanel, ByRef wallpaper As Wallpaper)
    MyBase.Show(dockpanel)
    SetWallpaper(wallpaper)
  End Sub

  Private Sub SetWallpaper(ByRef wallpaper As Wallpaper)
    _wallpaper = wallpaper
    PictureBox1.ImageLocation = Configuration.GetObject.SkinsPath & _wallpaper.Filename
    Me.Name = _wallpaper.FullName & " [" & _wallpaper.Filename & "]"
    Me.TabText = _wallpaper.FullName & " [" & _wallpaper.Resolution & "/" & _wallpaper.ID & "]"
    MdiMain._pf.SetWallpaperInformation(_wallpaper)
    MdiMain.Text = "Wallpaper Manager - " & Me.TabText
  End Sub

  Private Sub ImageViewForm_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
    MdiMain._pf.SetWallpaperInformation(_wallpaper)
    MdiMain.Text = "Wallpaper Manager - " & Me.TabText
  End Sub

  Private Sub ImageViewForm_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
    MdiMain.Text = "Wallpaper Manager"
  End Sub

  Public Shadows Sub Close()
    Me.Visible = False
  End Sub

  Public Sub NotifyChange(ByVal c As Boolean) Implements IChangeListener.NotifyChange

  End Sub

  Public Sub DoChange(ByVal o As Object) Implements IChangeListener.DoChange
    SetWallpaper(o)
  End Sub


End Class